package org.wheel.plugins.toolkit.sql.entity;

import java.util.Objects;

/**
 * 实体类 + 字段名 复合键
 */
public final class FieldKey {
    private final Class<?> entityClass;
    private final String fieldName;

    public FieldKey(Class<?> entityClass, String fieldName) {
        this.entityClass = entityClass;
        this.fieldName = fieldName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FieldKey fieldKey = (FieldKey) o;
        return entityClass.equals(fieldKey.entityClass) && fieldName.equals(fieldKey.fieldName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(entityClass, fieldName);
    }
}